package cn.lsc.controller;

import cn.lsc.doc.courseDoc;
import cn.lsc.dto.CourseSearchDto;
import cn.lsc.result.JSONResult;
import cn.lsc.result.PageList;
import cn.lsc.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RequestMapping("/search")
@RestController
public class searchController {
    @Autowired
    private ISearchService iSearchService;

    @PostMapping("/searchcourse")
    public JSONResult savechcourse(@RequestBody courseDoc courseDoc){
        iSearchService.savechcourse(courseDoc);
        return JSONResult.success();
    }
    @PostMapping("/course")
    public JSONResult searchCourse(@RequestBody CourseSearchDto dto){
        PageList<courseDoc> courseDocs = iSearchService.searchCourse(dto);
        return JSONResult.success(courseDocs);
    }


}
